/**
 * Icon 组件
 * 封装了「AT基础Icon」和「业务Icon」，通过biz参数区分
 */

import React from 'react';
import { YunxiaoIcon } from '@alife/yunxiao-icon';
import PropTypes from 'prop-types';

export default class CodeIcon extends React.Component {
  static propTypes = {
    biz: PropTypes.string, // 业务名，biz 是 business 简写
  };

  static defaultProps = {
    biz: 'basic', // 默认为基础图标
  };

  // 按钮中icon需要这个标识
  static _typeMark = 'icon';

  render() {
    const { biz, ...others } = this.props;

    switch (biz) {
      case 'basic':
        others.source = 'at';
        break;
      case 'code':
        others.source = 'cd';
        break;
      default:
        others.source = 'at';
        break;
    }

    return <YunxiaoIcon {...others} />;
  }
}
